import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router'

import Find from '@/views/Find'
import My from '@/views/My'
import Friend from '@/views/Friend'

// VueRouter插件初始化
Vue.use(VueRouter)
// 创建路由对象
const router = new VueRouter({
  // 路由规则 {path: 规则, component: 组件}
  routes: [
    {
      path: '/find',
      component: Find
    },
    {
      path: '/my',
      component: My
    },
    {
      path: '/friend',
      component: Friend
    },
  ]
})

Vue.config.productionTip = false

// 封装全局指令
Vue.directive('focus', {
  // 指令所在的dom元素,被插入到页面中时触发
  inserted(el) {
    el.focus()
  }
})

new Vue({
  render: h => h(App),
  router
}).$mount('#app')
